package com.dd.service.Impl;

import com.dd.entity.User;
import com.dd.mapper.UserMapper;
import com.dd.service.UserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;


    @Override
    public User getUserById(Integer id) {
        System.out.println("通过服务层拿用户Id");
        System.out.println(id);
        return userMapper.getUserById(id);
    }

    @Override
    public int insertUser(String username,String sex) {
        System.out.println("通过服务层插入用户");
        return userMapper.insertUser(username,sex);
    }

    @Override
    public int deleteUser(Integer id) {
        System.out.println("通过服务层删除用户");
        return userMapper.deleteUser(id);
    }

    @Override
    public int updateUser(User user) {
        System.out.println("通过服务层修改用户");
        return userMapper.updateUser(user);
    }

    @Override
    public List<User> userList(String name, String sex) {
        System.out.println("通过服务层通过名字和性别查询用户");
        return userMapper.selectUser(name, sex);
    }
}
